import "package:ct_pa_majordomo/utils/request.dart";
import "package:dio/dio.dart";


class NoticeApi {
  // 获取通告列表
  Future<Map> getNoticeList(queryParameters) async {
    Response response = await request.get(
      "apartment/notification/list",
      queryParameters: queryParameters,
    );
    return response.data ?? {};
  }

  // 获取通告详情
  Future<Map> getNoticeDetail(int notificationId) async {
    Response response = await request.get(
      "apartment/notification/$notificationId",
    );
    return response.data ?? {};
  }

  // 读取通告
  Future<Map> readNotice(int notificationId) async {
    Response response = await request.put(
      "apartment/notification/read/$notificationId",
    );
    return response.data ?? {};
  }

  // 批量读取通告
  Future<Map> batchReadNotice(String notificationIds) async {
    Response response = await request.put(
      "apartment/notification/read/batch/$notificationIds",
    );
    return response.data ?? {};
  }

  // 批量删除通告
  Future<Map> batchDeleteNotice(String notificationIds) async {
    Response response = await request.delete(
      "apartment/notification/$notificationIds",
    );
    return response.data ?? {};
  }
}

NoticeApi noticeApi = NoticeApi();
